﻿using System.Numerics;
namespace Primer
{
    internal struct Tumbler
    {
        public BigInteger ID;
        public BigInteger N;
        internal uint Mark;

        //public Tumbler(BigInteger id, BigInteger n, uint mark)
        //{
        //    ID = id;
        //    N = n;
        //    Mark = mark;
        //}
        public Tumbler(ref BigInteger id, BigInteger n, uint mark)
        {
            ID = id;
            N = n;
            Mark = mark;
        }

        public static bool Tumble(ref Tumbler value, uint mark)
        {
            uint delta = 1; // (mark != 0 ? mark - value.Mark : 1); value.Mark = mark;
            value.N += delta;
            if (value.ID <= value.N)
            {
                value.N -= value.ID;
                return true;
            }
            return false;
        }
    }
}
